using System;
using SharpWind.States;
using SharpWind;
using SharpWind.Input;
using Microsoft.Xna.Framework.Input;
using SharpWind.Scripting;
using SharpWind.Resources;
using SharpWind.Graphics.Text;
using Microsoft.Xna.Framework.Graphics;
using SharpWind.Sound;

namespace XnaFpsGame.States
{
	public class InputTestState : State
	{
		private int gun = 0;

		private InputManager input = null;

		private Content content = null;

		private Sound menuMusic = null;

		public InputTestState()
			: base( "InputTest" )
		{
			this.input	 = Engine.Instance.Input;
			this.content = Engine.Instance.Content;
		}


		public override void Load()
		{
			this.input.RegisterControl( "Exit", InputType.Digital, Keys.Escape );
			this.input.RegisterControl( "Connect", InputType.Digital, Keys.C );
			this.input.RegisterControl( "Reset", InputType.Digital, Keys.R );
		}

		public override void Update( Microsoft.Xna.Framework.GameTime gameTime )
		{
			if( this.input.ControlState( "Exit" ) == 1f )
			{
				Engine.Instance.Exit();
			}

			if( this.input.ControlState( "Connect" ) == 1f )
			{
				Engine.Instance.Network.Connect( "127.0.0.1", 5070, "sho" );
			}

			if( this.input.ControlState( "Reset" ) == 1f )
			{
				Engine.Instance.PerformanceMonitor.Reset();
			}
		}

		public override void Close()
		{
			this.input.ClearMappings();
		}
	}
}
